/* GroupEntity - Decompiled by JODE
 * Visit http://jode.sourceforge.net/
 */
package net.da.core.entity;

import java.util.List;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name="groups")
public class GroupEntity extends PersistentObjectEntity
{
    private String name;

//    @OneToMany(mappedBy="group")
//    private List<SysUserEntity> users;

    //TODO: this is unclear...
    @OneToMany(mappedBy="parentGroup")
    private List<GroupEntity> groups;

    @ManyToOne
    @JoinColumn(name="parent_id")
    private GroupEntity parentGroup;

    private String description;

//    @ManyToOne
//    @JoinColumn(name="owner_id")
//    private SysUserEntity owner;

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
	return name;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getDescription() {
	return description;
    }

//    public void setOwner(SysUserEntity owner) {
//        this.owner = owner;
//    }
//
//    public SysUserEntity getOwner() {
//        return owner;
//    }
//
//    public void addUser(SysUserEntity user) {
//        getUsers().add(user);
//    }
//
//    public void removeUser(SysUserEntity user) {
//        getUsers().remove(user);
//    }
//
//    public void removeAllUsers() {
//        getUsers().clear();
//    }

//    public List<SysUserEntity> getUsers() {
//        return users;
//    }

    public void addGroup(GroupEntity group) {
        groups.add(group);
    }

    public void removeGroup(GroupEntity group) {
        groups.remove(group);
    }

    public void removeAllGroups() {
        groups.clear();
    }

    public List<GroupEntity> getGroups() {
        return groups;
    }

    public void setParentGroup(GroupEntity parentGroup) {
        this.parentGroup = parentGroup;
    }

    public GroupEntity getParentGroup() {
        return parentGroup;
    }

}
